package com.ssy.lingxi.settle.accounts.controller;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.dto.request.AddSettlementApplyAmountVO;
import com.ssy.lingxi.dto.request.CallbackCommunicationPayVO;
import com.ssy.lingxi.dto.request.InvoiceProveGetVO;
import com.ssy.lingxi.dto.response.InvoiceProveVO;
import com.ssy.lingxi.settle.accounts.service.IMemberReceiptInvoiceService;
import com.ssy.lingxi.settle.accounts.service.IMemberSettlementService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 会员结算内部接口
 * @author 伍将
 * @date 2021/3/24
 * @version 2.0.0
 */
@RestController
@RequestMapping("/settle/accounts/member/feign")
public class MemberSettlementFeignController {

    @Resource
    private IMemberSettlementService memberSettlementService;

    @Resource
    private IMemberReceiptInvoiceService receiptInvoice;

    /**
     * 新增请款单
     * @author 伍将
     * @date 2021/3/24
     **/
    @RequestMapping(value = "/addApplyAmount", method = RequestMethod.POST)
    public Wrapper<Void> addApplyAmount(@RequestBody @Valid AddSettlementApplyAmountVO addVO) {
        return memberSettlementService.addApplyAmount(addVO);
    }

    /**
     * 获取发票凭证
     * @author ds
     * @date 2021/4/12
     **/
    @RequestMapping(value = "/getInvoiceProve")
    public Wrapper<List<InvoiceProveVO>> getInvoiceProve(@RequestBody @Valid InvoiceProveGetVO getVO) {
        return receiptInvoice.getInvoiceProve(null, getVO);
    }


    /**
     * 应付账款-通联支付-回调地址
     * @param request 请求参数
     * @return 处理结果
     */
    @RequestMapping("/settlement/callback/communication/pay")
    public Wrapper<Boolean> confirmCommunicationPay(@RequestBody @Valid CallbackCommunicationPayVO request) {
        return memberSettlementService.callbackCommunicationPay(request);
    }
}
